<template>
	<view>
		<view style="border-bottom: 1px solid #eee;z-index: 998;position: fixed;width: 100%;">
			<u-tabs :list="list" :is-scroll='isScroll' active-color="#111111" :current="current" @change="change"></u-tabs>
		</view>
		<mescroll-item ref="mescrollItem" v-for="(tab,i) in list" :key="i" :i="i" :index="current" :type="type" :tabs="list">
		</mescroll-item>
	</view>
</template>

<script>
	let app = getApp();
	import {
		mapGetters
	} from "vuex";
	import MescrollItem from "./order-more-item.vue";
	import MescrollMoreMixin from "@/components/mescroll-uni/mixins/mescroll-more.js";
	export default {
		mixins: [MescrollMoreMixin], // 多个mescroll-body写在子组件时, 则使用mescroll-more.js补充子组件的页面生命
		components: {
			MescrollItem
		},
		data() {
			return {
				list:[{
					name: this.$t('publicLang.all'), //全部
					value: 'all'
				}, {
					name: this.$t('publicLang.pendingPayment'),//待付款
					value: 'unPaid'
				}, {
					name: this.$t('publicLang.confirming'),//确认中
					value: 'confirm'
				}, {
					name: this.$t('publicLang.toBeDelivered'),//待发货
					value: 'notShipped'
				}, {
					name: this.$t('publicLang.pendingReceipt'),//待收货
					value: 'spike'
				}, {
					name: this.$t('publicLang.compensatoryRefund'),//补偿性退款
					value: 'rebate'
				}, {
					name: this.$t('publicLang.refunding'),//退款中
					value: 'refunding'
				}, {
					name: this.$t('publicLang.refunds'),//退货退款
					value: 'refunded'
				}, {
					name: this.$t('publicLang.completed'),//已完成
					value: 'complete'
				}, {
					name: this.$t('publicLang.cancelled'),//已取消
					value: 'cancel'
				}],
				current: 0,
				isScroll:true,
				type: 0, // 判断是否是全部订单，还是售后订单或是云仓和自建
			};
		},
		onShow() {
		},
		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {
			// type  0是全部，1是自建  2是云仓 3是全部售后  4是自建售后 5是云仓售后
			this.type = options.type
			uni.setNavigationBarTitle({
				title: this.$t(`navigation.${options.title}`)
			})
			if(options.current){
				this.current = options.current
			}
			
			if (options.isAfterSale=="true") {
				this.isScroll = false
				this.list = [{
					name: this.$t('publicLang.refunding'),
					value: 'refunding'
				}, 
				// {
				// 	name: '补偿性退款',
				// 	value: 'rebate'
				// }, 
				{
					name: this.$t('publicLang.refunds'),
					value: 'refunded'
				}]
			}
			console.info(options.type)
		},
		methods: {
			change(index) {
				this.current = index;
				if (this.$refs.mescrollItem[index].isInit){
					this.$refs.mescrollItem[index].mescroll.resetUpScroll(true)
				}
			}
		}
	}
</script>

<style scoped lang="scss">

</style>
